package WaiBao;

import java.util.Arrays;

public class YangJie {
    public static void main(String[] args) {
        String[] name = {"马冬梅(班长)", "胡雪芳(副班长)", "小李(学习委员)", "罗丽英(组织委员)", "李冬梅(团支书)", "徐小勇", "毛伟明", "杨根华", "向桂英", "杨云", "杨成光", "于环评",
                "杨平", "杨祖梅", "余晖", "增钧", "曾强", "罗青", "郭钧学", "周润发", "卢影", "王国纯", "李爱萍", "曾宇", "刘涛涛", "张闫", "李艳萍", "杨建琼",
                "邓涛", "杨洁(学生)"};//考生本人: 杨洁(学生) 学号:210813021133
        int[] age = {19, 222, 18, 21, 18, 21, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 19, 20, 18};//最后一位：考生年龄:18


        double[] ying1 = {84, 72, 87, 80, 79, 63, 78, 84, 80, 80, 91, 87, 85, 89, 65, 68, 99, 99, 94, 88, 92, 91, 91, 65, 75, 74, 94, 74, 88, 95};
        double[] ying2 = {94, 78, 69, 71, 75, 94, 71, 69, 91, 67, 90, 77, 66, 95, 65, 65, 76, 79, 66, 98, 72, 71, 95, 81, 75, 88, 84, 64, 80, 95};
        double[] ying3 = {71, 76, 84, 81, 77, 66, 78, 69, 88, 80, 93, 87, 85, 65, 65, 68, 69, 96, 95, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 96};



        double jiaogua1;//代表每个学生的总分
        double jiaogua2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            jiaogua1 = ying1[i] + ying2[i] + ying3[i];
//            jiaogua2 = (jiaogua1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + jiaogua1);
//            System.out.println(name[i] + "的平均分为:" + jiaogua2);
//        }


        double write = 0, black = 0;
        double[] blue = new double[30];
//        for (int i = 0; i < 30; i++) {
//            write = ying1[i] + ying2[i]+ ying3[i];
//            black = (write * 1.0) / 3;
//           blue[i] = black;
//        }
//
//        for (int i = 0; i < blue.length - 1; i++) {
//            for (int j = 0; j < blue.length - i - 1; j++) {
//                if (blue[j] < blue[j + 1]) {
//                    double tep = blue[j];
//                    blue[j] = blue[j + 1];
//                    blue[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(blue[i]);
//        }


        double yellow1 = 0,yellow2 = 0, yellow3 = 0;//计算每门课的平均分
        double red1 = 0,  red2 = 0, red3 = 0;//计算每门课标准差
        double orange1 = 0,orange2 = 0, orange3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <ying1.length; i++) {
            he +=ying1[i];
        }
        yellow1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" + yellow1);
        double Sum = 0;
        for (int i = 0; i < ying2.length; i++) {
            Sum += ying2[i];
        }
        yellow2 = (Sum * 1.0) / 30;
        System.out.println("物理化学的班级平均分为:" + yellow2);
        double sum = 0;
        for (int i = 0; i < ying3.length; i++) {
            sum += ying3[i];
        }
        yellow3 = (sum * 1.0) / 30;
        System.out.println("电子与电工技术的班级平均分为:" + yellow3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i < ying1.length; i++) {
            c1 += (ying1[i] - yellow1) * (ying1[i] -yellow1);
        }
        red1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" +  red1);
        for (int i = 0; i < ying2.length; i++) {
            c2 += (ying2[i] - yellow2) * (ying2[i] - yellow2);
        }
        red2 = Math.sqrt(c2*1.0/30);
        System.out.println("物理化学的班级标准差为:" +  red2);

        for (int i = 0; i < ying3.length; i++) {
            c3 += (ying3[i] - yellow3) * (ying3[i] - yellow3);
        }
        red3 = Math.sqrt(c3*1.0/30);
        System.out.println("电子与电工技术的班级标准差为:" + red3);
////////
//////
//////
//        Arrays.sort(ying1);
//        Arrays.sort(ying2);
//        Arrays.sort(ying3);
//        orange1 = (ying1[14] + ying2[15]) * 1.0 / 2;
//        orange2 = (ying2[14] + ying2[15]) * 1.0 / 2;
//        orange3 = (ying3[14] + ying3[15]) * 1.0 / 2;
//        System.out.println("生物化学的中位数为:" + orange1);
//        System.out.println("物理化学的中位数为:" + orange2);
//        System.out.println("电子与电工技术的中位数为:" + orange3);




    }
}
